package com.ganlinux.pangoo.controller.restful.footmark;

import com.alibaba.fastjson.JSON;
import com.ganlinux.pangoo.controller.restful.base.BaseController;
import com.ganlinux.pangoo.dao.model.RecomendedFootmarks;
import com.ganlinux.pangoo.dao.model.UserFootmarkList;
import com.ganlinux.pangoo.entity.request.ReqFootMarkStatistics;
import com.ganlinux.pangoo.entity.request.ReqFootPrintSimpleInfoList;
import com.ganlinux.pangoo.entity.response.RspFootMarkStatisticsData;
import com.ganlinux.pangoo.entity.response.RspFootPrintRecommendedListData;
import com.ganlinux.pangoo.entity.response.base.RspBase;
import com.jfinal.aop.Before;
import com.jfinal.kit.HttpKit;

/**
 * BlogController
 * 所有 sql 与业务逻辑写在 Model 或 Service 中，不要写在 Controller 中，养成好习惯，有利于大型项目的开发与维护
 */
@Before(FootMarkStatisticsInterceptor.class)
public class FootMarkStatisticsController extends BaseController {
	public void save() {
		if(isCheckAccess()) {
			RspBase rspLogin = new RspBase();
			String pin = null;
			int pageindex = 1;
			int pagesize = 10;
			String jsonString = HttpKit.readData(getRequest());
			ReqFootMarkStatistics reqLogin = JSON.parseObject(jsonString, ReqFootMarkStatistics.class);
			reqLogin.setReqHeader(getHeaderFromRequest(getRequest()));

			pin = reqLogin.getReqHeader().getPin();
			RspFootMarkStatisticsData rspGetTravelSimpleListData = UserFootmarkList.dao.getFootMarkStatistics(pin);
			if (rspGetTravelSimpleListData == null) {
				rspLogin.setStatus(1);
				rspLogin.setMessage("失败");
			} else {
				rspLogin.setData(rspGetTravelSimpleListData);
				rspLogin.setStatus(0);
				rspLogin.setMessage("成功");
			}
			renderText(JSON.toJSONString(rspLogin));
		}else {
			RspBase rspBase = new RspBase();
			rspBase.setStatus(1);
			rspBase.setMessage("身份验证失败");
			renderText(JSON.toJSONString(rspBase));
		}
	}

}


